<?php
/**
 * 活动
*/


defined('InShopNC') or exit('Access Invalid!');

class channelControl extends BaseHomeControl {
	public function __construct(){
		parent::__construct();
		$this->web_channels = Model('web_channels');
	}
	public function listOp(){
		$condition['channel_id'] = '602';
		$channel_list = $this->web_channels->showOneData($condition);

		$condition_t['web_id'] = $channel_list['top_id'];
		$tp_list = $this->web_channels->getWebList($condition_t);
		
		$condition_f['web_id'] = array('in',$channel_list['floor_ids']);
		$fl_list = $this->web_channels->getWebList($condition_f);

		Tpl::output('tp_list',$tp_list);
		Tpl::output('fl_list',$fl_list);
		Tpl::output('channel_list',$channel_list);
		Tpl::showpage('channel_list');
	}
	/**
	 * ajax获取 右边 促销商品
	 */
	public function get_right_listOp(){
		$gc_id = $_GET['gc_id'];
		
		$condition['class_id'] = 1;			//分类id
		$model_groupbuy = Model('groupbuy');
		//获取抢购详细信息
        $groupbuy_list = $model_groupbuy->getGroupbuyOnlineList($condition);

        $html = '<div class="sale"><ul>';
        foreach ($groupbuy_list as $key => $value) {
        	$count_down = $value['end_time']-$value['start_time'];
        	$html .='<li>
		      <div class="goods-thumb" style=" background-image:url('.gthumb($value["groupbuy_image"],"max").');"><a href="'.$value["groupbuy_url"].'" target="_blank">&nbsp;</a></div>
		      <dl>
		        <dt class="goods-name">'.$value["groupbuy_name"].'</dt>
		        <dd class="goods-price"><strong>&yen;'.$value["groupbuy_price"].'</strong><span class="sell">已售<em>'.$value["buy_quantity"].'</em></span></dd>
		      </dl>
		      <div class="time-remain" count_down="'.$count_down.'"><em time_id="d">0</em>天<em time_id="h">0</em>小时 <em time_id="m">0</em>分<em time_id="s">0</em>秒</div>
		    </li>';
        }
		$html .='</ul></div>';
		echo $html;
	}
}
